function varargout = sctransp_1(varargin)
% SCTRANSP_1 M-file for sctransp_1.fig
%      SCTRANSP_1, by itself, creates a new SCTRANSP_1 or raises the existing
%      singleton*.
%
%      H = SCTRANSP_1 returns the handle to a new SCTRANSP_1 or the handle to
%      the existing singleton*.
%
%      SCTRANSP_1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SCTRANSP_1.M with the given input arguments.
%
%      SCTRANSP_1('Property','Value',...) creates a new SCTRANSP_1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before sctransp_1_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to sctransp_1_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help sctransp_1

% Last Modified by GUIDE v2.5 16-Apr-2012 12:29:21

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @sctransp_1_OpeningFcn, ...
                   'gui_OutputFcn',  @sctransp_1_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before sctransp_1 is made visible.
function sctransp_1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to sctransp_1 (see VARARGIN)

% Choose default command line output for sctransp_1
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes sctransp_1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%if exist(strcat(data.param.direc,'/data.mat')) == 2
%    load (strcat(data.param.direc,'/data.mat'),'data');
%end
global data;
data.param.Gcierre = true;

if (data.param.cust_diff)
    set(handles.cb_diffusion,'Value',1.0);
    set(handles.rb_diffusion_2,'Value',1.0);
    set(handles.rb_diffusion_1,'Enable','On');
    set(handles.rb_diffusion_2,'Enable','On');
elseif (data.param.diffusion~=0)
    set(handles.cb_diffusion,'Value',1.0);
    set(handles.rb_diffusion_1,'Value',1.0);
    set(handles.edit_diffusion,'String',num2str(data.param.diffusion));
    set(handles.edit_diffusion,'Enable','On');
    set(handles.rb_diffusion_1,'Enable','On');
    set(handles.rb_diffusion_2,'Enable','On');
else
    set(handles.cb_diffusion,'Value',0.0);
end
if (data.param.cust_conv)
    set(handles.cb_convection,'Value',1.0);
    set(handles.rb_convection_2,'Value',1.0);
    set(handles.rb_convection_1,'Enable','On');
    set(handles.rb_convection_2,'Enable','On');
elseif (data.param.convection_x~=0) 
    set(handles.cb_convection,'Value',1.0);
    set(handles.rb_convection_1,'Value',1.0);
    set(handles.edit_convection_x,'String',num2str(data.param.convection_x));
    set(handles.edit_convection_x,'Enable','On');
    set(handles.rb_convection_1,'Enable','On');
    set(handles.rb_convection_2,'Enable','On');
    if (data.param.type_geo~=1)
        set(handles.edit_convection_y,'String',num2str(data.param.convection_y));
        set(handles.edit_convection_y,'Enable','On');
    end
else
    set(handles.cb_convection,'Value',0.0);
end
if (data.param.cust_sour)
    set(handles.cb_source,'Value',1.0);
    set(handles.rb_source_2,'Value',1.0);
    set(handles.rb_source_1,'Enable','On');
    set(handles.rb_source_2,'Enable','On');
elseif (data.param.source~=0)
    set(handles.cb_source,'Value',1.0);
    set(handles.rb_source_1,'Value',1.0);
    set(handles.edit_source,'String',num2str(data.param.source));
    set(handles.edit_source,'Enable','On');
    set(handles.rb_source_1,'Enable','On');
    set(handles.rb_source_2,'Enable','On');
else
    set(handles.cb_source,'Value',0.0);
end
if (data.param.cust_reac)
    set(handles.cb_reaction,'Value',1.0);
    set(handles.rb_reaction_2,'Value',1.0);
    set(handles.rb_reaction_1,'Enable','On');
    set(handles.rb_reaction_2,'Enable','On');
elseif (data.param.reaction~=0)
    set(handles.cb_reaction,'Value',1.0);
    set(handles.rb_reaction_1,'Value',1.0);
    set(handles.edit_reaction,'String',num2str(data.param.reaction));
    set(handles.edit_reaction,'Enable','On');
    set(handles.rb_reaction_1,'Enable','On');
    set(handles.rb_reaction_2,'Enable','On');
else
    set(handles.cb_reaction,'Value',0.0);
end
if (data.param.cust_temp)
    set(handles.cb_temporal,'Value',1.0);
    set(handles.rb_temporal_2,'Value',1.0);
    set(handles.rb_temporal_1,'Enable','On');
    set(handles.rb_temporal_2,'Enable','On');
elseif (data.param.temporal~=0)
    set(handles.cb_temporal,'Value',1.0);
    set(handles.rb_temporal_1,'Value',1.0);
    set(handles.edit_temporal,'String',num2str(data.param.temporal));
    set(handles.edit_temporal,'Enable','On');
    set(handles.rb_temporal_1,'Enable','On');
    set(handles.rb_temporal_2,'Enable','On');
else
    set(handles.cb_temporal,'Value',0.0);
end
    

% --- Outputs from this function are returned to the command line.
function varargout = sctransp_1_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
I = imread('images/eq_sctransp.jpg');
imshow(I) 


% Hint: place code in OpeningFcn to populate axes1


% --- Executes on button press in cb_diffusion.
function cb_diffusion_Callback(hObject, eventdata, handles)
% hObject    handle to cb_diffusion (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of cb_diffusion
if(get(hObject,'Value'))
    set(handles.rb_diffusion_1,'Enable','On');
    set(handles.rb_diffusion_2,'Enable','On');
    set(handles.rb_diffusion_1,'Value',1.0);
    set(handles.edit_diffusion,'Enable','On');
else
    set(handles.rb_diffusion_1,'Enable','Off');
    set(handles.rb_diffusion_2,'Enable','Off');
    set(handles.rb_diffusion_1,'Value',0.0);
    set(handles.rb_diffusion_2,'Value',0.0);
    set(handles.edit_diffusion,'Enable','Off');
end


% --- Executes on button press in cb_convection.
function cb_convection_Callback(hObject, eventdata, handles)
% hObject    handle to cb_convection (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of cb_convection
global data;
if(get(hObject,'Value'))
    set(handles.rb_convection_1,'Enable','On');
    set(handles.rb_convection_2,'Enable','On');
    set(handles.rb_convection_1,'Value',1.0);
    set(handles.edit_convection_x,'Enable','On');
    set(handles.label_Ux,'Enable','On');
    if data.mesh.ndm==2
        set(handles.edit_convection_y,'Enable','On');
        set(handles.label_Uy,'Enable','On');
    end
else
    set(handles.rb_convection_1,'Enable','Off');
    set(handles.rb_convection_2,'Enable','Off');
    set(handles.rb_convection_1,'Value',0.0);
    set(handles.rb_convection_2,'Value',0.0);
    set(handles.edit_convection_x,'Enable','Off');
    set(handles.label_Ux,'Enable','Off');
    if data.mesh.ndm==2
        set(handles.label_Uy,'Enable','Off');
        set(handles.edit_convection_y,'Enable','Off');
    end
end

% --- Executes on button press in cb_source.
function cb_source_Callback(hObject, eventdata, handles)
% hObject    handle to cb_source (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of cb_source
if(get(hObject,'Value'))
    set(handles.rb_source_1,'Enable','On');
    set(handles.rb_source_2,'Enable','On');
    set(handles.rb_source_1,'Value',1.0);
    set(handles.edit_source,'Enable','On');
else
    set(handles.rb_source_1,'Enable','Off');
    set(handles.rb_source_2,'Enable','Off');
    set(handles.rb_source_1,'Value',0.0);
    set(handles.rb_source_2,'Value',0.0);
    set(handles.edit_source,'Enable','Off');
end

% --- Executes on button press in cb_reaction.
function cb_reaction_Callback(hObject, eventdata, handles)
% hObject    handle to cb_reaction (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of cb_reaction
if(get(hObject,'Value'))
    set(handles.rb_reaction_1,'Enable','On');
    set(handles.rb_reaction_2,'Enable','On');
    set(handles.rb_reaction_1,'Value',1.0);
    set(handles.edit_reaction,'Enable','On');
else
    set(handles.rb_reaction_1,'Enable','Off');
    set(handles.rb_reaction_2,'Enable','Off');
    set(handles.rb_reaction_1,'Value',0.0);
    set(handles.rb_reaction_2,'Value',0.0);
    set(handles.edit_reaction,'Enable','Off');
end


% --- Executes on button press in cb_temporal.
function cb_temporal_Callback(hObject, eventdata, handles)
% hObject    handle to cb_temporal (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of cb_temporal
if(get(hObject,'Value'))
    set(handles.rb_temporal_1,'Enable','On');
    set(handles.rb_temporal_2,'Enable','On');
    set(handles.rb_temporal_1,'Value',1.0);
    set(handles.edit_temporal,'Enable','On');
else
    set(handles.rb_temporal_1,'Enable','Off');
    set(handles.rb_temporal_2,'Enable','Off');
    set(handles.rb_temporal_1,'Value',0.0);
    set(handles.rb_temporal_2,'Value',0.0);
    set(handles.edit_temporal,'Enable','Off');
end


function edit_K_Callback(hObject, eventdata, handles)
% hObject    handle to edit_K (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_K as text
%        str2double(get(hObject,'String')) returns contents of edit_K as a double


% --- Executes during object creation, after setting all properties.
function edit_K_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_K (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%global data;
%save(strcat(data.param.direc,'/data'), 'data');
global data;
data.param.Gcierre = false;

close sctransp_1 
%set(main,'Visible','on')
geo_1


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% set(sctransp_1,'Visible','off') 
% set(geo_3,'Visible','on')
global data;
data.param.Gcierre = false;
correct=1;
tot_ter=0;

diff=0; conv_x=0; conv_y=0; 
reac=0; sour=0; temp=0;

c_diff=false; c_conv=false; c_reac=false;
c_sour=false; c_temp=false;

if get(handles.cb_diffusion,'Value')
    tot_ter=tot_ter+1;
    if get(handles.rb_diffusion_1,'Value')
        diff=str2num(get(handles.edit_diffusion,'String'));
        if isempty(diff)
            correct=0;
        end
    else
        c_diff=true;
        filename = strcat([data.param.Gdirec,'/custom_diffusion.m']);
        s = ['edit ' filename];
        eval(s)
        %s = strcat(['gedit ', filename]);
        %system(s);
    end
end
if get(handles.cb_convection,'Value')
    tot_ter=tot_ter+1;
    if get(handles.rb_convection_1,'Value')
        conv_x=str2num(get(handles.edit_convection_x,'String'));
        if(data.mesh.ndm==2)
            conv_y=str2num(get(handles.edit_convection_y,'String'));
        else
            conv_y=0;
        end
        if isempty(conv_x) || isempty(conv_y)
            correct=0;
        end
    else
        c_conv=true;
        filename = strcat([data.param.Gdirec,'/custom_convection.m']);
        s = ['edit ' filename];
        eval(s)
        %s = strcat(['gedit ', filename]);
        %system(s);
    end
end
if get(handles.cb_reaction,'Value')
    tot_ter=tot_ter+1;
    if get(handles.rb_reaction_1,'Value')
        reac=str2num(get(handles.edit_reaction,'String'));
        if isempty(reac)
            correct=0;
        end
    else
        c_reac=true;
        filename = strcat([data.param.Gdirec,'/custom_reaction.m']);
        s = ['edit ' filename];
        eval(s)
        %s = strcat(['gedit ', filename]);
        %system(s);
    end
end
if get(handles.cb_source,'Value')
    tot_ter=tot_ter+1;
    if get(handles.rb_source_1,'Value')
        sour=str2num(get(handles.edit_source,'String'));
        if isempty(sour)
            correct=0;
        end
    else
        c_sour=true;
        filename = strcat([data.param.Gdirec,'/custom_source.m']);
        s = ['edit ' filename];
        eval(s)
        %s = strcat(['gedit ', filename]);
        %system(s);
    end
end
if get(handles.cb_temporal,'Value')
    tot_ter=tot_ter+10;
    if get(handles.rb_temporal_1,'Value')
        temp=str2num(get(handles.edit_temporal,'String'));
        if isempty(temp)
            correct=0;
        end
    else
        c_temp=true;
        filename = strcat([data.param.Gdirec,'/custom_temporal.m']);
        s = ['edit ' filename];
        eval(s)
        %s = strcat(['gedit ', filename]);
        %system(s);
    end
end

if (tot_ter==0)
    warndlg('At least one term must be selected in the model');
elseif (tot_ter==10)
    warndlg('Another term in addition to the temporal term should be selected');
else
    if correct
        %set(obj.param,{'diff','conv_x','conv_y','reac','sour','temp'}, num2cell([diff,conv_x,conv_y,reac,sour,temp]) );
        data.param.b_set(diff,conv_x,conv_y,reac,sour,temp);
        data.param.c_set(c_diff,c_conv,c_reac,c_sour,c_temp);
        if c_diff || c_conv || c_reac || c_sour || c_temp
            hh = warndlg('Custom parameters must be programmed before run the problem. Matlab editor, with these files, has been opened.','caution','modal'); 
            uiwait(hh);
        end
        %save(strcat(data.param.Gdirec,'/data'), 'data');
        close sctransp_1;
        geo_3;
    else
        warndlg('Input must be numerical');
    end
end

% --- Executes during object creation, after setting all properties.
function uipanel2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to uipanel2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


function edit_diffusion_Callback(hObject, eventdata, handles)
% hObject    handle to edit_diffusion (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_diffusion as text
%        str2double(get(hObject,'String')) returns contents of edit_diffusion as a double


% --- Executes during object creation, after setting all properties.
function edit_diffusion_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_diffusion (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in rb_diffusion_1.
function rb_diffusion_1_Callback(hObject, eventdata, handles)
% hObject    handle to rb_diffusion_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_diffusion_1
if(get(hObject,'Value'))
    set(handles.edit_diffusion,'Enable','On');
else
    set(handles.edit_diffusion,'Enable','Off');
end


% --- Executes on button press in rb_diffusion_2.
function rb_diffusion_2_Callback(hObject, eventdata, handles)
% hObject    handle to rb_diffusion_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_diffusion_2
if(get(hObject,'Value'))
    set(handles.edit_diffusion,'Enable','Off');
end

% --- Executes on button press in rb_convection_1.
function rb_convection_1_Callback(hObject, eventdata, handles)
% hObject    handle to rb_convection_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_convection_1
if(get(hObject,'Value'))
    set(handles.edit_convection_x,'Enable','On');
else
    set(handles.edit_convection_x,'Enable','Off');
end


% --- Executes on button press in rb_convection_2.
function rb_convection_2_Callback(hObject, eventdata, handles)
% hObject    handle to rb_convection_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_convection_2
if(get(hObject,'Value'))
    set(handles.edit_convection_x,'Enable','Off');
end

% --- Executes on button press in rb_source_1.
function rb_source_1_Callback(hObject, eventdata, handles)
% hObject    handle to rb_source_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_source_1
if(get(hObject,'Value'))
    set(handles.edit_source,'Enable','On');
else
    set(handles.edit_source,'Enable','Off');
end

% --- Executes on button press in rb_source_2.
function rb_source_2_Callback(hObject, eventdata, handles)
% hObject    handle to rb_source_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_source_2
if(get(hObject,'Value'))
    set(handles.edit_source,'Enable','Off');
end

% --- Executes on button press in rb_reaction_1.
function rb_reaction_1_Callback(hObject, eventdata, handles)
% hObject    handle to rb_reaction_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_reaction_1
if(get(hObject,'Value'))
    set(handles.edit_reaction,'Enable','On');
else
    set(handles.edit_reaction,'Enable','Off');
end

% --- Executes on button press in rb_reaction_2.
function rb_reaction_2_Callback(hObject, eventdata, handles)
% hObject    handle to rb_reaction_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_reaction_2
if(get(hObject,'Value'))
    set(handles.edit_reaction,'Enable','Off');
end

% --- Executes on button press in rb_temporal_1.
function rb_temporal_1_Callback(hObject, eventdata, handles)
% hObject    handle to rb_temporal_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_temporal_1
if(get(hObject,'Value'))
    set(handles.edit_temporal,'Enable','On');
else
    set(handles.edit_temporal,'Enable','Off');
end

% --- Executes on button press in rb_temporal_2.
function rb_temporal_2_Callback(hObject, eventdata, handles)
% hObject    handle to rb_temporal_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of rb_temporal_2
if(get(hObject,'Value'))
    set(handles.edit_temporal,'Enable','Off');
end

function edit_temporal_Callback(hObject, eventdata, handles)
% hObject    handle to edit_temporal (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_temporal as text
%        str2double(get(hObject,'String')) returns contents of edit_temporal as a double


% --- Executes during object creation, after setting all properties.
function edit_temporal_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_temporal (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_reaction_Callback(hObject, eventdata, handles)
% hObject    handle to edit_reaction (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_reaction as text
%        str2double(get(hObject,'String')) returns contents of edit_reaction as a double


% --- Executes during object creation, after setting all properties.
function edit_reaction_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_reaction (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_source_Callback(hObject, eventdata, handles)
% hObject    handle to edit_source (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_source as text
%        str2double(get(hObject,'String')) returns contents of edit_source as a double


% --- Executes during object creation, after setting all properties.
function edit_source_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_source (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit_convection_x_Callback(hObject, eventdata, handles)
% hObject    handle to edit_convection_x (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_convection_x as text
%        str2double(get(hObject,'String')) returns contents of edit_convection_x as a double


% --- Executes during object creation, after setting all properties.
function edit_convection_x_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_convection_x (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes during object creation, after setting all properties.
function next_CreateFcn(hObject, eventdata, handles)
% hObject    handle to next (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate next





function edit_convection_y_Callback(hObject, eventdata, handles)
% hObject    handle to edit_convection_y (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit_convection_y as text
%        str2double(get(hObject,'String')) returns contents of edit_convection_y as a double


% --- Executes during object creation, after setting all properties.
function edit_convection_y_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_convection_y (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes during object creation, after setting all properties.
function eqn_CreateFcn(hObject, eventdata, handles)
% hObject    handle to eqn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate eqn
%imshow('images/eq_sctransp.png')
%imshow('images/eq_sctransp.png');

  
% text('Interpreter','latex');
% %text(0,0,'\rho c_p \frac{\partial \phi}{\partial t}  + \nabla \cdot
% (\mathbf{u} \phi) = \nabla \cdot (k\nabla \phi) + R\phi + G_\phi')


% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure
global data;
if (data.param.Gcierre)
    resp=questdlg('Está seguro que desea salir?','EduFEM');
    if strcmp(resp,'Yes')
        save(strcat(data.param.Gdirec,'/data'), 'data');
        delete(hObject);
    end
else
    delete(hObject);
end 


% --- Executes during object deletion, before destroying properties.
function figure1_DeleteFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


